import React, { lazy } from "react";
import { Navigate } from "react-router-dom";
import { RouteRawState } from "../types";
// 首页
const HomeIndex = lazy(() => import("../views/home"));
const HomeSearch = lazy(() => import("../views/home/search"));
const HomeKnowledgeBase = lazy(() => import("../views/home/knowledgeBase"));
const HomeKnowledgeBaseDetail = lazy(
  () => import("../views/home/knowledgeBase/detail")
);
const HomeInformation = lazy(() => import("../views/home/information"));
const HomeInformationDetail = lazy(
  () => import("../views/home/information/detail")
);

export const HomeRoutes: RouteRawState[] = [
  {
    path: "/home",
    element: <HomeIndex></HomeIndex>,
    meta: {
      title: "首页",
    },
  },
  {
    path: "/home/search",
    element: <HomeSearch></HomeSearch>,
    meta: {
      title: "搜索",
    },
  },
  {
    path: "/home/knowledgebase",
    element: <HomeKnowledgeBase></HomeKnowledgeBase>,
    meta: {
      title: "",
    },
  },
  {
    path: "/home/knowledgebase/:id",
    element: <HomeKnowledgeBaseDetail></HomeKnowledgeBaseDetail>,
    meta: {
      title: "首页",
    },
  },
  {
    path: "/home/information",
    element: <HomeInformation></HomeInformation>,
    meta: {
      title: "首页",
    },
  },
  {
    path: "/home/information/:id",
    element: <HomeInformationDetail></HomeInformationDetail>,
    meta: {
      title: "首页",
    },
  },
  {
    path: "/",
    element: <Navigate to="/home"></Navigate>,
    meta: {
      title: "首页",
    },
  },
];

const RoutesList: RouteRawState[] = HomeRoutes.concat([]);

export default RoutesList;
